var project_id = $.trim($("#project_id").val());
var design_cell_id = $.trim($("#design_cell_id").val());

function init_Data(url){
    $.get(url, function(result){
 	   $(".layui-show").html("");
 	   $(".layui-show").html(result);
     });
}
function formulaData(data_id){
    var url = base+"/projectCenter/designcell/formulaIndex/"+design_cell_id+"/"+project_id+"/"+data_id;
    init_Data(url);
}
function constantData(data_id){
    var url = base+"/projectCenter/designcell/index/"+design_cell_id+"/"+project_id+"/"+data_id;
    init_Data(url);
}
function caculateData(data_id){
    var url = base+"/projectCenter/designcell/dcsjInfo/"+design_cell_id+"/"+project_id+"/"+data_id;
    init_Data(url);
}

var design_data = function(){
	var data_id = $(this).attr("data_id");
	if("sjcl" == data_id){
		constantData(data_id);
	}else if("jsgs" == data_id){
		formulaData(data_id);
	}else if("jsjg" == data_id){
		caculateData(data_id);
	}
}

//取用常量
var qyClBatch = function(){
    $.ajax({
        url:base+"/projectCenter/designcell/takeConstantIS/"+project_id+"/"+design_cell_id,
        data:{},
        async:false,
        success:function(data,status){
          /*  if(data!=""&&data!=null){
                if(data.statusCode == 0){
                    layer.msg('一键取用成功', {icon: 1,time:2000});
                }else{
                    layer.msg(data.message, {icon: 2,time:2000});
                }
            }else{
                layer.msg('一键取用失败!', {icon: 2,time:2000});
            }*/
        }
    });
}

//取用公式
var qyGsBatch = function(){
    $.ajax({
        url:base+"/projectCenter/designcell/takeFormulaIS/"+design_cell_id+"/"+project_id,
        data:{},
        async:false,
        success:function(data,status){
         /*   if(data!=""&&data!=null){
                if(data.statusCode == 0){
                    layer.msg('一键取用成功', {icon: 1,time:2000});
                }else{
                    layer.msg(data.message, {icon: 2,time:2000});
                }
            }else{
                layer.msg('一键取用失败!', {icon: 2,time:2000});
            }*/
        }
    });
}

$(document).ready(function(){
	layer.load(1);
	qyGsBatch();
	//取用常量
	qyClBatch();
	layer.closeAll('loading');
	$(".layui-tab-title li").click(design_data);
	$(".layui-this").trigger("click");
	//在这里先默认取用公式以及常量
	//取用公式
	
	
});